<template>
	<view class="fwcontainer">
		<view class="uni-flex uni-column page-list">
			 <view class="uni-flex uni-row page-list-item" v-for="(item,index) in dataOptionList" :data-index="index" :data-action="item.action" @click="bindClick">
				 <text class="text euni-flex-autowidth">{{item.text}}</text>
				 <uni-icons type="arrowright"></uni-icons>
			 </view>
		</view>
		<view class="page-exit fwtheme-bgcolor" @click="bindExit">安全退出</view>
	</view>
</template>

<script>

	const APP = getApp();

	export default {
		components: {
			
		},
		data() {
			return {
				//设置数据
				dataOptionList:[
					{text:'重置密码',action:'resetpwd'},
					{text:'技术支持',action:'tech'}
				]
			}
		},
		methods: {
			bindExit(e){
				APP.apptool.showModalConfirm('提示', '确认退出账号？', '取消', '确认', function(confirm, cancel){
					if(cancel) return;
					
					let _this = this;
					APP._post('/api/login/logout', {}, null, function (res) {
					  //执行成功
					  if (res.code === APP.appconfig.fwcode.successed) {
						  try{
							 uni.clearStorageSync();
							 APP.apptool.showToastInfo(res.msg,null,1000,function(){
								uni.reLaunch({
									url:'/pages/basic/login/index'
								}); 
							 });
						  }catch(e){
							  console.error(e);
							  APP.apptool.showModalInfo(res.msg)
						  }
					  } else {
						APP.apptool.showToastInfo(res.msg);
					  }
					}, function (res) {
					  //执行失败
					}, function (res) {
					  //执行完成
					});
				})
			},
			bindClick(e){
				let target = e.currentTarget.dataset;
				if('resetpwd' == target.action){
					uni.navigateTo({
						url:'/pages/owner/sub/reset-pwd'
					})
				}else if('tech' == target.action){
					uni.navigateTo({
						url:'/pages/owner/sub/tech-support'
					})
				}
			},
			loadPageData() {
				
			}
		},
		//生命周期
		onLoad() {
			this.loadPageData();
		},
		onShow() {

		},
		onReady() {

		},
		onPullDownRefresh() {
			
		},
		onReachBottom() {
			
		},
		onHide() {

		},
		onUnload() {

		},
		onBackPress(options) {

		},
		onPageScroll(e) {

		},
	}
</script>


<style>
	.page-list{
		width: 100%;
	}
	.page-list .page-list-item{
		padding: 20rpx 20rpx;
		border-bottom: 0.5rpx solid #DDDDDD;
		background-color: #FFFFFF;
	}
	.page-exit{		
		position: fixed;
		width: 700rpx;
		margin: 0rpx 25rpx;
		text-align: center;
		justify-items: center;
		padding: 10rpx 0rpx;
		border-radius: 20rpx;
		bottom: 60px;
		color: #FFFFFF;
	}
</style>
